package br.com.graficafuxico.modelo;

import java.util.Calendar;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@Entity
public class Blog {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	@Column(nullable=false)
	private Calendar dataPublicacao;
	
	@Column(nullable=false, unique=true)
	private String titulo;
	
	@Column(nullable=false)
	private String descricao;

	@Column(nullable=false)
	private byte[] img;
	
	@OneToMany(mappedBy="blog", targetEntity=Comentario.class, fetch=FetchType.LAZY)
	private List<Comentario> comentarioList;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Calendar getDataPublicacao() {
		return dataPublicacao;
	}

	public void setDataPublicacao(Calendar dataPublicacao) {
		this.dataPublicacao = dataPublicacao;
	}

	public String getTitulo() {
		return titulo;
	}

	public void setTitulo(String titulo) {
		this.titulo = titulo;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public byte[] getImg() {
		return img;
	}

	public void setImg(byte[] img) {
		this.img = img;
	}

	public List<Comentario> getComentarioList() {
		return comentarioList;
	}

	public void setComentarioList(List<Comentario> comentarioList) {
		this.comentarioList = comentarioList;
	}

}
